; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -o - -verify-dom-info | FileCheck %s
; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -disable-check-noreturn-call=true -o - -verify-dom-info | FileCheck --check-prefix=DISNOTET %s

; Function Attrs: sspreq
define void @_Z7catchesv() #0 personality ptr null {
; CHECK-LABEL: _Z7catchesv:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushq %rax
; CHECK-NEXT:    .cfi_def_cfa_offset 16
; CHECK-NEXT:    movq %fs:40, %rax
; CHECK-NEXT:    movq %rax, (%rsp)
; CHECK-NEXT:  .Ltmp0:
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    xorl %edi, %edi
; CHECK-NEXT:    xorl %esi, %esi
; CHECK-NEXT:    xorl %edx, %edx
; CHECK-NEXT:    callq *%rax
; CHECK-NEXT:  .Ltmp1:
; CHECK-NEXT:  # %bb.1: # %invoke.cont
; CHECK-NEXT:    movq %fs:40, %rax
; CHECK-NEXT:    cmpq (%rsp), %rax
; CHECK-NEXT:    jne .LBB0_6
; CHECK-NEXT:  # %bb.2: # %SP_return
; CHECK-NEXT:  .Ltmp2:
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    xorl %edi, %edi
; CHECK-NEXT:    callq *%rax
; CHECK-NEXT:  .Ltmp3:
; CHECK-NEXT:  # %bb.3: # %invoke.cont2
; CHECK-NEXT:  .LBB0_4: # %lpad1
; CHECK-NEXT:  .Ltmp4:
; CHECK-NEXT:    movq %fs:40, %rax
; CHECK-NEXT:    cmpq (%rsp), %rax
; CHECK-NEXT:    jne .LBB0_6
; CHECK-NEXT:  # %bb.5: # %SP_return3
; CHECK-NEXT:    popq %rax
; CHECK-NEXT:    .cfi_def_cfa_offset 8
; CHECK-NEXT:    retq
; CHECK-NEXT:  .LBB0_6: # %CallStackCheckFailBlk
; CHECK-NEXT:    .cfi_def_cfa_offset 16
; CHECK-NEXT:    callq __stack_chk_fail@PLT
;
; DISNOTET-LABEL: _Z7catchesv:
; DISNOTET:       # %bb.0: # %entry
; DISNOTET-NEXT:    pushq %rax
; DISNOTET-NEXT:    .cfi_def_cfa_offset 16
; DISNOTET-NEXT:    movq %fs:40, %rax
; DISNOTET-NEXT:    movq %rax, (%rsp)
; DISNOTET-NEXT:  .Ltmp0:
; DISNOTET-NEXT:    xorl %eax, %eax
; DISNOTET-NEXT:    xorl %edi, %edi
; DISNOTET-NEXT:    xorl %esi, %esi
; DISNOTET-NEXT:    xorl %edx, %edx
; DISNOTET-NEXT:    callq *%rax
; DISNOTET-NEXT:  .Ltmp1:
; DISNOTET-NEXT:  # %bb.1: # %invoke.cont
; DISNOTET-NEXT:  .Ltmp2:
; DISNOTET-NEXT:    xorl %eax, %eax
; DISNOTET-NEXT:    xorl %edi, %edi
; DISNOTET-NEXT:    callq *%rax
; DISNOTET-NEXT:  .Ltmp3:
; DISNOTET-NEXT:  # %bb.2: # %invoke.cont2
; DISNOTET-NEXT:  .LBB0_3: # %lpad1
; DISNOTET-NEXT:  .Ltmp4:
; DISNOTET-NEXT:    movq %fs:40, %rax
; DISNOTET-NEXT:    cmpq (%rsp), %rax
; DISNOTET-NEXT:    jne .LBB0_5
; DISNOTET-NEXT:  # %bb.4: # %SP_return
; DISNOTET-NEXT:    popq %rax
; DISNOTET-NEXT:    .cfi_def_cfa_offset 8
; DISNOTET-NEXT:    retq
; DISNOTET-NEXT:  .LBB0_5: # %CallStackCheckFailBlk
; DISNOTET-NEXT:    .cfi_def_cfa_offset 16
; DISNOTET-NEXT:    callq __stack_chk_fail@PLT
entry:
  %call = invoke i64 null(i32 0, ptr null, i64 0)
          to label %invoke.cont unwind label %lpad1

invoke.cont:                                      ; preds = %entry
  invoke void null(i32 0) #1
          to label %invoke.cont2 unwind label %lpad1

invoke.cont2:                                     ; preds = %invoke.cont
  unreachable

lpad1:                                            ; preds = %invoke.cont, %entry
  %0 = landingpad { ptr, i32 }
          cleanup
  ret void
}

; uselistorder directives
uselistorder ptr null, { 5, 4, 3, 2, 1, 0 }

attributes #0 = { sspreq }
attributes #1 = { noreturn }
